UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F6J29k5I0CSpBgSRNd83+D+cdX3t4PczT1mvKrZEnzg=' 
WHERE 
  key_id = 'a9f4171629bcb1fa821b50a51031071044737d224acff7c8268275dc594f9d89' 
  AND (
    token = 'F6J29k5I0CSpBgSRNd83+D+cdX3t4PczT1mvKrZEnzg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039