UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3wXJiAxAA7HcKtASJHGdPg/G3hoxAJeWyYcQQVAIYD8='
WHERE
key_id = '41247a9776074fb2acb7ccf8d92d8fc8f92410289ab1bed064f1582f82918b15'
AND (
token = '3wXJiAxAA7HcKtASJHGdPg/G3hoxAJeWyYcQQVAIYD8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)