UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ARE9ILathD/eiGIepAA8fxqnNZofVkZvqN5TEpyOo8k='
WHERE
key_id = '39a8b1886e34a10b12eca4ce1ae6b3ca85531aef0bb1325f703a24ae5fcadba2'
AND (
token = 'ARE9ILathD/eiGIepAA8fxqnNZofVkZvqN5TEpyOo8k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)