UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4obf91xU7J0CLIOcmY/oarISPpcr3LLpONd+NM8KdYg='
WHERE
key_id = '802ae1ebb9d50735e940c9ba01b8157ad2f494e338b47ee5c24df42f1d5b5988'
AND (
token = '4obf91xU7J0CLIOcmY/oarISPpcr3LLpONd+NM8KdYg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)