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