UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8jowjLcWad4nbLZTAkp7T9Yr8YKyBZNdi31Ye0zYfgI='
WHERE
key_id = '4cfa583ab8b71ed6c56ebc5ebfa5de8a502dfd3a1a935f7e5ff6f80cff0227ba'
AND (
token = '8jowjLcWad4nbLZTAkp7T9Yr8YKyBZNdi31Ye0zYfgI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)