UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v5LOaX0NUolhOZIri/SSsAP1DSMVh4SeJode1QXEbIw=' 
WHERE 
  key_id = 'e3dee89738e81877fca07f82046c02061d67aae07dbbd1c28e80d34b887f003c' 
  AND (
    token = 'v5LOaX0NUolhOZIri/SSsAP1DSMVh4SeJode1QXEbIw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030