UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pqYbwe9x8wQ8N2q5qapPDxuJZ7SihHxTFVdWAzydtXc='
WHERE
key_id = 'c44e2d109dd06515986368c3303ce588947b27f06a8a4ef176da83f04b87a531'
AND (
token = 'pqYbwe9x8wQ8N2q5qapPDxuJZ7SihHxTFVdWAzydtXc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)