UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4lMk5KdaKdggeOxElqMflECkcZJUpEdIbJtZfDAkAwo='
WHERE
key_id = '39172d055396b0fc14bcf519d447bb235e1cf8c7afa515637a2f06a224b8735e'
AND (
token = '4lMk5KdaKdggeOxElqMflECkcZJUpEdIbJtZfDAkAwo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)