UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BSU0i/+ZVcgyOB1TspCyYkQlCR5/x6OupL1wz7NCw8k='
WHERE
key_id = '0997c03029d64a9a97d3ee300847de5a4009f507e6a68c60f88a7ad98dc22d90'
AND (
token = 'BSU0i/+ZVcgyOB1TspCyYkQlCR5/x6OupL1wz7NCw8k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)