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