UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/dbLya+5pPRQzQO1HSkLZEBDvzwAYwwPWElQqD9zfK4='
WHERE
key_id = 'c7c4e8895117146144b389085354e0a176552c0bd848e405bba3cf87995c8973'
AND (
token = '/dbLya+5pPRQzQO1HSkLZEBDvzwAYwwPWElQqD9zfK4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)