UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kAbJ0zU8JPpGFJtS30G4zWjjoayzzdvzncFDpipc4R0='
WHERE
key_id = 'f17e8b6d072647809f474436785cca3cebe74e3a4b0b30cfa93ebcf37e7fbf9e'
AND (
token = 'kAbJ0zU8JPpGFJtS30G4zWjjoayzzdvzncFDpipc4R0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)