UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A3crKPouEEZvrrk9Zh6Qpng+4P3UnAIrMoz62A8KiC8='
WHERE
key_id = 'b76dd1c5a8d53578b6ae763168ae2f8e52117a3684911da0bf67639f376facea'
AND (
token = 'A3crKPouEEZvrrk9Zh6Qpng+4P3UnAIrMoz62A8KiC8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)