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