UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qEtyE3rFgXDaiRC+V5NKID2jPlFmbuKTXqHLipdmVn0='
WHERE
key_id = 'b6b0927438cbb55579cbd0d5bcffd010fd90138df0cb6d2e454aedc05b80baca'
AND (
token = 'qEtyE3rFgXDaiRC+V5NKID2jPlFmbuKTXqHLipdmVn0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)