UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'erjPRm3KOJZkmMz1knvNO8HQc+Shb0iwo1C0dRCKRJg='
WHERE
key_id = 'feec5901a1837b4012b111d40af24af9198c227d0a2e9259678794c4ac1415a3'
AND (
token = 'erjPRm3KOJZkmMz1knvNO8HQc+Shb0iwo1C0dRCKRJg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)