UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ka+FO95eyVWswhIOxqjkm/TBgiKnaylA9Ye8rZNLY50='
WHERE
key_id = 'a4062067ff43b07aa14c56f6a92ad098bdef5a206559ee27fd3f206ace1496ed'
AND (
token = 'Ka+FO95eyVWswhIOxqjkm/TBgiKnaylA9Ye8rZNLY50='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)