UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gv44QnI6avxIS0lvobG/G+cpRjzeKTl3/zYCdl6g1Hw='
WHERE
key_id = '940b67c31e6d797977488ba3023af1f9310c029383fe892575d341d811d03b35'
AND (
token = 'gv44QnI6avxIS0lvobG/G+cpRjzeKTl3/zYCdl6g1Hw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)