UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BXDQojL+NrKkCBsAQIE2tBk/TgidXLKHW46CjaZGXP4='
WHERE
key_id = 'f05bca2a40ecfff9c3888133c4f0ac977adc73574b8fe0827105b2b81d3dc390'
AND (
token = 'BXDQojL+NrKkCBsAQIE2tBk/TgidXLKHW46CjaZGXP4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)