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