UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oU2tgmVXiuK0arse0ac00X/9BCYG5I6kMpEZEEvrerI='
WHERE
key_id = 'a8ae8344bc9d27d05ca613e054eca503c9f13cb1774d2bbf6865d05622f23fda'
AND (
token = 'oU2tgmVXiuK0arse0ac00X/9BCYG5I6kMpEZEEvrerI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)