UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5Q8DVMbLrGBCgaCyRXTt0LYL0j2flanOjNXfQIldjbA=' 
WHERE 
  key_id = 'c7e3301f2ad3a52888f17ce2e14898849f21e47a08bfe2e5a04cca46c8ad8c69' 
  AND (
    token = '5Q8DVMbLrGBCgaCyRXTt0LYL0j2flanOjNXfQIldjbA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026