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