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