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

Query time 0.00035