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