UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '87jiVGNwINDZ2MxXxZq10M2oosEmx3NHqn5jlmY6eOY='
WHERE
key_id = 'ef6049b89f3f3e61d8d2fdfab35cea7fc5ed34ff8d303d941d91b7d21564c1b0'
AND (
token = '87jiVGNwINDZ2MxXxZq10M2oosEmx3NHqn5jlmY6eOY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)