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