UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u8vD7EvzQL3f0oK5H2E1AxRHh6ooROXdkEuEBdqzmJA='
WHERE
key_id = '7f31ff12f7492525e1db8c98791794ed41881caba52ff8431e992ecdf3f6cb8e'
AND (
token = 'u8vD7EvzQL3f0oK5H2E1AxRHh6ooROXdkEuEBdqzmJA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)